package org.huawei260.OD260;

import java.util.Scanner;

/**
 * @Auther: qingle
 * @Date: 2024/8/21-23:46
 * @Description:
 * @version: 1.0
 */
public class O0013_航天器 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] strs = s.split(",");

		int[] arr = new int[strs.length];
		for (int i = 0; i < strs.length; i++) {
			arr[i] = Integer.parseInt(strs[i]);
		}

		System.out.println(findMaxArea(arr));


	}

	private static int findMaxArea(int[] heights) {
		int maxArea = 0;
		int left = 0;
		int right = 0;

		while (right < heights.length) {
			// 计算当前两根支柱间的面积
			int currentArea = (right - left) * Math.min(heights[left], heights[right]);
			maxArea = Math.max(maxArea, currentArea);

			// 如果左边支柱的高度大于右边，移动左边的指针
			if (heights[left] > heights[right]) {
				left++;
			} else {
				// 否则，移动右边的指针
				right++;
			}
		}

		return maxArea;
	}
}
